<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      Valgrind-3.15.0
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-9.1">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 9.1
      </h4>
      <h3>
        Chapter&nbsp;13.&nbsp;Programming
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="vala.html" title="Vala-0.46.6">Prev</a>
          <p>
            Vala-0.46.6
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="yasm.html" title="yasm-1.3.0">Next</a>
          <p>
            yasm-1.3.0
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="valgrind" name="valgrind"></a>Valgrind-3.15.0
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to Valgrind
        </h2>
        <p>
          <span class="application">Valgrind</span> is an instrumentation
          framework for building dynamic analysis tools. There are Valgrind
          tools that can automatically detect many memory management and
          threading bugs, and profile programs in detail. Valgrind can also
          be used to build new tools.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "https://sourceware.org/ftp/valgrind/valgrind-3.15.0.tar.bz2">
                https://sourceware.org/ftp/valgrind/valgrind-3.15.0.tar.bz2</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download (FTP): <a class="ulink" href=
                "ftp://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2">ftp://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 46e5fbdcbc3502a5976a317a0860a975
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 19 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 425 MB (add 70 MB for tests)
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: 0.6 SBU (Using parallelism=4; add 11
                SBU for tests)
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Valgrind Dependencies
        </h3>
        <h4>
          Optional
        </h4>
        <p class="optional">
          <a class="xref" href="../server/bind.html" title=
          "BIND-9.14.10">BIND-9.14.10</a> or <a class="xref" href=
          "../basicnet/bind-utils.html" title="BIND Utilities-9.14.10">BIND
          Utilities-9.14.10</a> (for tests), <a class="xref" href=
          "boost.html" title="Boost-1.72.0">Boost-1.72.0</a>, <a class="xref"
          href="gdb.html" title="GDB-9.1">GDB-9.1</a> (for tests), <a class=
          "xref" href="llvm.html" title="LLVM-9.0.1">LLVM-9.0.1</a> (with
          Clang), and <a class="xref" href="which.html" title=
          "Which-2.21 and Alternatives">Which-2.21</a> (for tests)
        </p>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/valgrind">http://wiki.linuxfromscratch.org/blfs/wiki/valgrind</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of Valgrind
        </h2>
        <p>
          Install <span class="application">Valgrind</span> by running the
          following commands:
        </p>
        <pre class="userinput">
<kbd class="command">sed -i 's|/doc/valgrind||' docs/Makefile.in &amp;&amp;

./configure --prefix=/usr \
            --datadir=/usr/share/doc/valgrind-3.15.0 &amp;&amp;
make</kbd>
</pre>
        <p>
          To test the results, issue: <span class="command"><strong>make
          regtest</strong></span>. The tests may hang forever if <a class=
          "xref" href="gdb.html" title="GDB-9.1">GDB-9.1</a> is not
          installed. Some tests are known to hang also, depending on the
          version of glibc. Problematic tests can be disabled by changing the
          <strong class="userinput"><code>prereq:</code></strong> line in the
          corresponding <code class="filename">.vgtest</code> file to
          <strong class="userinput"><code>prereq: false</code></strong>. For
          example:
        </p>
        <pre class="userinput">
<kbd class="command">sed -e 's@prereq:.*@prereq: false@' \
    -i {helgrind,drd}/tests/pth_cond_destroy_busy.vgtest</kbd>
</pre>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            The <span class="application">OpenMP</span> tests are skipped if
            libgomp has been compiled with <code class=
            "option">--enable-linux-futex</code> (the default). If needed,
            just recompile the libgomp library from the gcc build tree,
            passing <code class="option">--disable-linux-futex</code> to
            configure, storing the library to some place and changing the
            link from <code class="filename">/usr/lib/libgomp.so.1</code> to
            point to the new library.
          </p>
        </div>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make install</kbd>
</pre>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <span class="command"><strong>sed -i ...
          docs/Makefile.in</strong></span> : This sed provides for installing
          the documentation in a versioned directory.
        </p>
        <p>
          <code class="option">--enable-lto=yes</code>: This option allows
          building Valgrind with LTO (link time optimization). This produces
          a smaller/faster Valgrind (up to 10%), but build time increases to
          about 5.5 SBU.
        </p>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">callgrind_annotate, callgrind_control,
              cg_annotate, cg_diff, cg_merge, ms_print, valgrind,
              valgrind-di-server, valgrind-listener, and vgdb</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Library:</strong>
              <span class="segbody">libcoregrind-&lt;Arch&gt;-linux.a,
              libreplacemalloc_toolpreload-&lt;Arch&gt;-linux.a,
              libvex-&lt;Arch&gt;-linux.a, libvexmultiarch-amd64-linux.a,
              vgpreload_core-&lt;Arch&gt;-linux.so,
              vgpreload_drd-&lt;Arch&gt;-linux.so,
              vgpreload_exp-dhat-&lt;Arch&gt;-linux.so,
              vgpreload_exp-sgcheck-&lt;Arch&gt;-linux.so,
              vgpreload_helgrind-&lt;Arch&gt;-linux.so,
              vgpreload_massif-&lt;Arch&gt;-linux.so, and
              vgpreload_memcheck-&lt;Arch&gt;-linux.so, where &lt;Arch&gt; is
              x86 or amd64</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/usr/lib/valgrind, /usr/include/valgrind,
              and /usr/share/doc/valgrind-3.15.0</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="valgrind-prog" name=
                    "valgrind-prog"></a><span class="term"><span class=
                    "command"><strong>valgrind</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a program for debugging and profiling Linux
                    executables.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="callgrind_annotate" name=
                    "callgrind_annotate"></a><span class="term"><span class=
                    "command"><strong>callgrind_annotate</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    takes an output file produced by the <span class=
                    "application">Valgrind</span> tool Callgrind and prints
                    the information in an easy-to-read form.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="callgrind_control" name=
                    "callgrind_control"></a><span class="term"><span class=
                    "command"><strong>callgrind_control</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    controls programs being run by the <span class=
                    "application">Valgrind</span> tool Callgrind.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="cg_annotate" name="cg_annotate"></a><span class=
                    "term"><span class=
                    "command"><strong>cg_annotate</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a post-processing tool for the <span class=
                    "application">Valgrind</span> tool Cachegrind.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="cg_diff" name="cg_diff"></a><span class=
                    "term"><span class=
                    "command"><strong>cg_diff</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    compares two Cachegrind output files.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="cg_merge" name="cg_merge"></a><span class=
                    "term"><span class=
                    "command"><strong>cg_merge</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    merges multiple Cachegrind output files into one.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="ms_print" name="ms_print"></a><span class=
                    "term"><span class=
                    "command"><strong>ms_print</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    takes an output file produced by the <span class=
                    "application">Valgrind</span> tool Massif and prints the
                    information in an easy-to-read form.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="valgrind-di-server" name=
                    "valgrind-di-server"></a><span class="term"><span class=
                    "command"><strong>valgrind-di-server</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a server that reads debuginfo from objects stored on a
                    different machine.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="valgrind-listener" name=
                    "valgrind-listener"></a><span class="term"><span class=
                    "command"><strong>valgrind-listener</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    listens on a socket for Valgrind commentary.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="vgdb" name="vgdb"></a><span class=
                    "term"><span class=
                    "command"><strong>vgdb</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is an intermediary between Valgrind and GDB or a shell.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-02-17 08:21:25 -0800
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="vala.html" title="Vala-0.46.6">Prev</a>
          <p>
            Vala-0.46.6
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="yasm.html" title="yasm-1.3.0">Next</a>
          <p>
            yasm-1.3.0
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
